package com.msw.sentinel.service;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.msw.sentinel.util.ExceptionUtil;
import org.springframework.stereotype.Service;

/**
 * @author mashuangwei
 * @title: DemoService
 * @projectName sentinel-demo
 * @description: TODO
 * @date 2019-08-30
 */
@Service
public class DemoService {

    @SentinelResource(value = "sayHi", fallback = "sayLimt", blockHandler = "handleException", blockHandlerClass = {ExceptionUtil.class})
    public String sayHi(String content){
        return "hi " + content;
    }

    public String sayLimt(){
        System.err.println(" 已经受限");
        return "服务器维护中";
    }
}
